﻿using System.Collections.Generic;

namespace Firefly.Framework.Collections.Spatial
{
    public class QuadTreeNodeDistanceComparer<T> : IComparer<T>
    {
        #region IComparer<T> Members

        public int Compare(T left, T right)
        {
            int retval = (left as IQuadTreeNode).DistanceFromCamera.CompareTo((right as IQuadTreeNode).DistanceFromCamera);

            if (retval < 0)
            {
                return -1;
            }
            else
            {
                return (retval > 0) ? 1 : 0;
            }
        }

        #endregion
    }
}
